package branch_algorithm_study;

import java.util.Scanner;

public class Voyage_Fish {
    public static void main(String[] args) {
        int sum = 0;
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int n = scanner.nextInt();
        for (int i = 0; i < n; i++) {
            if (x != 6 & x != 7) {
                sum+=250;
            }
            if (x==7){
                x=1;
            }else{
                x++;
            }
        }
        System.out.println(sum);

    }
}